package it.pir.es10ChatWS;

import java.util.*;

import javax.jws.WebService;
import javax.xml.ws.soap.Addressing;
import com.sun.xml.ws.developer.*;

@WebService @Stateful @Addressing
public class Connection {

	public static StatefulWebServiceManager<Connection> manager;
	private String username;
	private Chat chat;
	
	public Connection(Chat chat, String username) {
		this.chat = chat;
		this.username = username;
	}
	
	public List<String> getUsers() {
		return chat.getUsersList();
	}
	
	public void send(String message) {
		chat.send(username, message);
	}
	
	public void sendPrivate(String message, String to) {
		
	}
	
	public void printMessage(String message) {
		System.out.println(message);
	}
}
